/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package dataflowScheme.impl;

import dataflowScheme.DataflowSchemePackage;
import dataflowScheme.SynchroConnection;

import dataflowScheme.SynchroPort;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Synchro Connection</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link dataflowScheme.impl.SynchroConnectionImpl#getOutPort <em>Out Port</em>}</li>
 *   <li>{@link dataflowScheme.impl.SynchroConnectionImpl#getInPort <em>In Port</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SynchroConnectionImpl extends EObjectImpl implements SynchroConnection {
	/**
	 * The cached value of the '{@link #getOutPort() <em>Out Port</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOutPort()
	 * @generated
	 * @ordered
	 */
	protected SynchroPort outPort;
	/**
	 * The cached value of the '{@link #getInPort() <em>In Port</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInPort()
	 * @generated
	 * @ordered
	 */
	protected SynchroPort inPort;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SynchroConnectionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DataflowSchemePackage.Literals.SYNCHRO_CONNECTION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SynchroPort getOutPort() {
		if (outPort != null && outPort.eIsProxy()) {
			InternalEObject oldOutPort = (InternalEObject)outPort;
			outPort = (SynchroPort)eResolveProxy(oldOutPort);
			if (outPort != oldOutPort) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataflowSchemePackage.SYNCHRO_CONNECTION__OUT_PORT, oldOutPort, outPort));
			}
		}
		return outPort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SynchroPort basicGetOutPort() {
		return outPort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOutPort(SynchroPort newOutPort) {
		SynchroPort oldOutPort = outPort;
		outPort = newOutPort;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataflowSchemePackage.SYNCHRO_CONNECTION__OUT_PORT, oldOutPort, outPort));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SynchroPort getInPort() {
		if (inPort != null && inPort.eIsProxy()) {
			InternalEObject oldInPort = (InternalEObject)inPort;
			inPort = (SynchroPort)eResolveProxy(oldInPort);
			if (inPort != oldInPort) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataflowSchemePackage.SYNCHRO_CONNECTION__IN_PORT, oldInPort, inPort));
			}
		}
		return inPort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SynchroPort basicGetInPort() {
		return inPort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInPort(SynchroPort newInPort) {
		SynchroPort oldInPort = inPort;
		inPort = newInPort;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataflowSchemePackage.SYNCHRO_CONNECTION__IN_PORT, oldInPort, inPort));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case DataflowSchemePackage.SYNCHRO_CONNECTION__OUT_PORT:
				if (resolve) return getOutPort();
				return basicGetOutPort();
			case DataflowSchemePackage.SYNCHRO_CONNECTION__IN_PORT:
				if (resolve) return getInPort();
				return basicGetInPort();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case DataflowSchemePackage.SYNCHRO_CONNECTION__OUT_PORT:
				setOutPort((SynchroPort)newValue);
				return;
			case DataflowSchemePackage.SYNCHRO_CONNECTION__IN_PORT:
				setInPort((SynchroPort)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case DataflowSchemePackage.SYNCHRO_CONNECTION__OUT_PORT:
				setOutPort((SynchroPort)null);
				return;
			case DataflowSchemePackage.SYNCHRO_CONNECTION__IN_PORT:
				setInPort((SynchroPort)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case DataflowSchemePackage.SYNCHRO_CONNECTION__OUT_PORT:
				return outPort != null;
			case DataflowSchemePackage.SYNCHRO_CONNECTION__IN_PORT:
				return inPort != null;
		}
		return super.eIsSet(featureID);
	}

} //SynchroConnectionImpl
